Lesson 9 Exercise: Using CSV Import and Export

Objective

In this exercise you will learn how to use CSV Import to model data created by another application. Then you will use CSV Export to export information from the model for inclusion in a textual report.

Try to complete the following steps on your own. If you need help, click the step to jump to a set of more detailed steps.

1	Start METIS and Create Exercise Model

Create a new model called MyExerciseL9 based on the Training template.

2	Import Model Data Created by Another Application

Import Person and Location objects into the Personnel container, including the located in Location relationship between them. Use the CSV file x:\METISdir\cbt\persons.csv, where x:\METISdir is the drive and directory for your METIS installation (if you accepted the default during installation, the file is located at c:\Program Files\METIS3.0\cbt\persons.csv.) and the predefined CSV rule IMPORT 3.

3	Resize Imported Objects

Force the size of the objects imported into the Personnel container to equal the size of other objects in the container; Perform Layout on the container.

4	Export Model Data for Inclusion in a Textual Report

Export information about all objects in the Personnel container to a file name personnel. Use the predefined CSV Rule EXPORT 2 to export the type label (for example, Person object type), the name and the description for each object.

5	Export Properties for a Selection of Objects

Export properties for all person objects in the Personnel container to a file named personnel_properties. View the file in a text editor.

6	Save the Model and Close METIS

7	Practice on Your Own (Optional)

Start METIS and Create Exercise Model

Complete the following steps to start METIS and create a new model file based on an example template:

1	Minimize your web browser and any other application you have open (except this window) to see your desktop.

2	Double-click the METIS icon [image] to launch METIS.

3	In the dialog box, click the Model From Template option.

4	In the template list, click Training, then click OK.

5	In the file dialog box, enter MyExerciseL9 for the filename and click Save.

6	Position this Exercise window so that you have a good view of the modeling window.

Import Model Data Created by Another Application

Import Person and Location objects into the Personnel container, including the located in Location relationship between them. Use the CSV file persons.csv and the predefined CSV rule IMPORT 3 as follows:

1	Select the Personnel container and click the Zoom Selection tool [image].

2	Right-click the Personnel container and click Import CSV.

3	In the CSV Import dialog box, click the CSV Rule field and select rule IMPORT 3.

4	In the CSV Import dialog box, click the lower Browse button.

5	In the Open dialog box, open the file x:\METISdir\cbt\persons.csv, where x:\METISdir is the drive and directory for your METIS installation (if you accepted the default during installation, the file is located at c:\Program Files\METIS3.0\cbt\persons.csv.)

6	Click the Preview button to preview the CSV Rule.

7	In the CSV Verification window, click Close.

8	In the CSV Import dialog box, click Import and then Close. METIS imports the new objects and relationships into the Personnel container and automatically lays them out.

Resize Imported Objects

Force the size of the objects imported into the Personnel container to equal the size of other objects in the container, and then Perform Layout on the container as follows:

1	Click the background or press the Esc key to deselect any objects.

2	Select the location object, Kingston, hold down Shift and then select the imported objects.

3	Click the Force Equal Size tool [image], and then the Equal Text Size tool [image]. The Force Equal Size tool [image] sets the size of the selected objects to the size of the primary selected object. The Equal Text Size tool [image] sets the text size of the selected objects to the size of the primary selected object.

4	Right-click the Personnel container, point to Layout and choose Perform Layout to lay out the objects again.

Example

Export Model Data for Inclusion in a Textual Report

Export information about all objects in the Personnel container to a file name personnel. Use the predefined CSV Rule EXPORT 2 to export the type label (for example, Person object type), the name and the description for each object as follows:

1	If necessary, click the background or press Esc to deselect all objects in the Personnel container.

2	Hold down the Shift key and drag an outline around all the objects in the Personnel container to select them.

3	Click the File menu and choose Export CSV.

4	In the CSV Export dialog box, click the CSV Rule field and select rule EXPORT 2.

5	In the CSV Export dialog box, click the What’s This button, then click the CSV Rule field to display Help about the rule. When you have reviewed the Help click again to remove it.

6	In the CSV Export dialog box, click the lower Browse button.

7	In the file dialog box, enter personnel for the filename and click Save.

8	In the CSV Export dialog box, click Export. METIS exports the selected persons and locations to the given file.

9	Launch a text editor (e.g., Notepad) and open the exported file personnel.csv (Wordpad and Excel can also be used) and view the file if you wish.

Example

Export Properties for a Selection of Objects

Export the properties for all person objects in the Personnel container as follows:

1	In the Personnel container, right-click a person object, point to Select From Criteria, and then click All Persons.

2	Right-click on an object, point to Property List, and then click Selected Objects.

3	Click the CSV icon [image] in the Property List dialog box.

4	Click Browse and enter personnel_properties for the name of the file and then click Save.

5	Select the All option.

6	If necessary, select the Column header option. Note that this option exports the property label (for example, name and description) and displays it as the heading for each column.

7	Select the Row header option. Note that this option exports the type label (for example, Container and Person object type) and displays it as the heading for each row.

8	Click Export in the CSV Export Properties dialog box to export the properties and close the dialog box.

9	Click OK in the Property List dialog box to close it.

10	Launch a text editor, such as Notepad, and open the exported file personnel_properties.csv and view the file if you wish. (Wordpad and Excel can also be used.)

 Example

Save the Model and Close METIS

Complete the following steps to complete the lesson:

1	From the File menu, click Save.

2	From the File menu, click Exit.

3	Close this window and maximize your browser to continue with the course.

Practice on Your Own (Optional)


Practice on Your Own (Optional)

•	Experiment with using different CSV rules to import and export data.

•	Perform a search to find all person objects in this model, and export the results to a CSV file. Then open the model you created for the first exercise, MyExerciseL2, and import the CSV file.


Imported Objects and Relationships

Back to Exercise


CSV File Displayed in Notepad

Back to Exercise


Properties Displayed in Notepad

Back to Exercise